/** \file nhb.h
 * \brief Neigbourhood module
 *
 * \todo Free memory after LOG_ERROR.
 */

#ifndef NBH_H
#define NBH_H

#include "../global.h"
#include "../chainedlib/chainedlist.h"


/// The neighbour list
extern CLNode_s* NBH_list;


/// Neighbour type
typedef ip_port_s neighbour_s; 


/// Intialize the neighbour list
void NBH_init(void);

/// Destroy the neighbour list
void NBH_destroy(void);


/// Add a neighbour, if not already in the list
void NBH_add(neighbour_s* nb);

/// Remove a neighbour.
void NBH_remove(neighbour_s* nb);

/** \brief Compare two neighbours
 * Used for searching in the list.
 * \return 1 if equal, 0 if not equal
 */
inline char NBH_test(neighbour_s* nb1, neighbour_s* nb2);


#endif

